//
//  XMLSendProductModel.m
//  ppkc2016
//
//  Created by 拼凑的断音 on 16/4/7.
//  Copyright © 2016年 拼凑的断音. All rights reserved.
//

#import "XMLSendProductModel.h"
#import "XXTool.h"

@implementation XMLSendProductModel

+(void)requestPeleaseGoodsWithreleaseInformation:(XMLSendProductModel *)model completion:(void (^)(BOOL))completion
{
    [DKHTTPRequest sendDataWithShortUrl:@"commerce_trade_release_goods"
                                  Param:[XXTool formatStringWithLanguage:[NSString stringWithFormat:@"userid=%@&passwd=%@&goodsname=%@&goodsdesc=%@",[UserInfo shareUserInfo].userID,[UserInfo shareUserInfo].userPassword,model.goods_name,model.goods_desc]]
                             ImageArray:model.list
                                TimeOut:10
                             Completion:^BOOL(NSMutableDictionary *serverDic, DKHTTPResponseType bufferType) {
                                 if ([[serverDic objectForKey:@"code"] intValue]==200)
                                 {
                                     if (completion)
                                     {
                                         completion(YES);
                                     }
                                     
                                 }
                                 else
                                 {
                                     if (completion)
                                     {
                                         completion(NO);
                                     }
                                 }
                                 return YES;
                             } IsBuffering:NO IsNeedReplaceWrap:NO
     IsUseUpLoadHead:NO];
}

+(void)requsetLastRelaseInformationWithCompletion:(void (^)(BOOL, XMLSendProductModel *))completion
{
    [DKHTTPRequest sendDataWithShortUrl:@"commerce_trade_goodslistdetail"
                                  Param:[XXTool formatStringWithLanguage:[NSString stringWithFormat:@"userid=%@&passwd=%@&goods_id=-1",[UserInfo shareUserInfo].userID,[UserInfo shareUserInfo].userPassword]]
                             ImageArray:nil
                                TimeOut:10
                             Completion:^BOOL(NSMutableDictionary *serverDic, DKHTTPResponseType bufferType) {
                                 if ([[serverDic objectForKey:@"code"] intValue]==200)
                                 {
                                     if (completion)
                                     {
                                         completion(YES,[XMLSendProductModel modelWithDictionary:serverDic]);
                                     }
                                     
                                 }
                                 else
                                 {
                                     if (completion)
                                     {
                                         completion(NO,nil);
                                     }
                                 }
                                 return YES;
                             } IsBuffering:YES IsNeedReplaceWrap:YES
     IsUseUpLoadHead:NO];
}

@end
